package ocean

import (
	"cid-media-api/api/common"
	"cid-media-api/models"
	"context"
	. "github.com/oceanengine/ad_open_sdk_go/models"
	"net/http"
)

func GetAdvertiserFund(account models.MediaAccount) *AdvertiserFundGetV2ResponseData {
	ctx := context.Background()

	res, _ := Call(func() (any, *http.Response, error) {
		return Api.AdvertiserFundGetV2Api().Get(ctx).
			AccessToken(account.AccessToken).
			AdvertiserId(account.AdvertiserId).
			Execute()
	}, common.GetAdvertiserFund())

	if res == nil {
		return nil
	}

	resData := res.(*AdvertiserFundGetV2Response).Data

	return resData
}
